package cn.cheln.explorer.actions;

import android.media.AudioRecord;
import android.os.Handler;
import android.os.Message;
import cn.cheln.support.log.Logs;

public class RecordThread extends Thread
{
  private static int BLOW_ACTIVI;
  private static int SAMPLE_RATE_IN_HZ = 8000;
  private AudioRecord ar = new AudioRecord(1, SAMPLE_RATE_IN_HZ, 2, 2, ???.bs);
  private int bs = 100;
  private long currenttime;
  private long endtime;
  private Handler handler;
  private Message msg;
  private int number = 1;
  private int tal = 1;
  private long time = 1L;

  static
  {
    BLOW_ACTIVI = 2620;
  }

  public RecordThread(Handler paramHandler)
  {
    this.handler = paramHandler;
  }

  public void run()
  {
    while (true)
    {
      byte[] arrayOfByte;
      int j;
      int k;
      try
      {
        this.ar.startRecording();
        Parameter.isblow = true;
        arrayOfByte = new byte[this.bs];
        do
        {
          if (!(Parameter.isblow))
          {
            this.ar.stop();
            this.ar.release();
            this.bs = 100;
            return;
          }
          this.number = (1 + this.number);
          sleep(8L);
          this.currenttime = System.currentTimeMillis();
          int i = 1 + this.ar.read(arrayOfByte, 0, this.bs);
          j = 0;
          k = 0;
          if (k < arrayOfByte.length)
            break label243;
          this.tal = (Integer.valueOf(j / i).intValue() + this.tal);
          this.endtime = System.currentTimeMillis();
          this.time += this.endtime - this.currenttime;
          Logs.e("---- time " + this.time + " --- number " + this.number);
        }
        while (((this.time < 500L) && (this.number <= 5)) || (this.tal / this.number <= BLOW_ACTIVI));
        this.handler.sendEmptyMessage(19);
        this.number = 1;
        this.tal = 1;
        this.time = 1L;
      }
      catch (Exception localException)
      {
        localException.printStackTrace();
        return;
      }
      label243: int l = arrayOfByte[k];
      int i1 = arrayOfByte[k];
      j += l * i1;
      ++k;
    }
  }
}

/* Location:           H:\360云盘\lewa_explorer_3.0\bin\FileApp_orig_dex2jar.jar
 * Qualified Name:     cn.cheln.explorer.actions.RecordThread
 * JD-Core Version:    0.5.2
 */